/**
 * BillViewMetaData.java
 * com.jamin.aabill.db
 *
 * Function： TODO 
 *
 *   ver     date      		author
 * ──────────────────────────────────
 *   		 2012-9-4 		wangjieming
 *
 * Copyright (c) 2012, TNT All Rights Reserved.
 */

package com.jamin.aabill.db;




/**
 * ClassName:BillViewMetaData
 *
 * @author   wangjieming
 * @version  1.0
 * @since    v1.0
 * @Date	 2012-9-4 下午1:59:53 
 */
public class BillViewMetaData {


	public static final String VIEW_NAME = "bill_view";

	public static final String CIRCLE_ID  = "circle_id";
	public static final String BILL_ID  = "bill_id";
	public static final String CIRCLE_MEMBER_NAME  = "name";
	public static final String CREATOR_MEMBER_ID = "creator_member_id";
	public static final String PROJECT  = "project";
	public static final String TYPE  = "type";
	public static final String DESCRIPTION  = "description";
	public static final String MODIFY_AT  = "modify_at";
	public static final String CREATE_AT  = "create_at";
	public static final String CIRCLE_MEMBER_ID  = "circle_member_id";
	public static final String MONEY  = "money";


	private static String SELECT_ALL_BILL_INFO = 
			"SELECT a.*,b.*,c." + CircleMemberTableMetaData.NAME +  " FROM "+ BillTableMetaData.TABLE_NAME +" a " 
					+ "LEFT JOIN " + BillDetailTableMetaData.TABLE_NAME + " b" 
					+ " on a."+ BillTableMetaData._ID +"=b." + BillDetailTableMetaData.BILL_ID
					+ " LEFT JOIN " + CircleMemberTableMetaData.TABLE_NAME + " c" +
					" on b." + BillDetailTableMetaData.CIRCLE_MEMBER_ID + "=c." + CircleMemberTableMetaData._ID +";";

	public static final String CREATE_VIEW_SQL =  "CREATE VIEW  "+VIEW_NAME +" AS " + SELECT_ALL_BILL_INFO;

	public static final String DROP_VIEW_SQL = "DROP VIEW IF EXISTS "+ VIEW_NAME;



}

